
public abstract class CaffeineBeverageWithHook {
	//metoda template
    public final void prepareRecipe()
{
            boilWater();
            brew();
            pourInCup();
            if(customerWantsCondiments())
            {
            addCondiments();
            }
    }
    
    //metoda de preparare a bauturii
    public abstract void brew();
    
    //metoda de adaugare a condimentelor
    public abstract void addCondiments();
    
    //algoritmul comun de fierbere a apei
    public void boilWater()
    {
            System.out.println("Boiling water");
    }
    
    //algoritmul comun de turnare a bauturii in pahare
    public void pourInCup()
    {
            System.out.println("Pouring in a cup");
    }
    
    //Hook-ul standard de decizie a folosirii condimentelor
    public boolean customerWantsCondiments()
    {
            return true;
    }

}
